public class Equition {
    int a;
    int b;
    int c;
    double x1;
    double x2;

    Equition(int a, int b, int c) {
        this.a = a;
        this.b = b;
        this.c  = c;
    }

    boolean solve() {
        boolean result = true;
        if (this.a == 0) {
            System.out.println("这不是一元二次方程。");
            result = false;
        } else if (this.b * this.b - 4 * this.a * this.c < 0) {
            System.out.println("一元二次方程无解。");
            result = false;
        } else {
            this.x1 = ((double)(-this.b) + Math.sqrt((double)(this.b * this.b - 4 * this.a * this.c))) / (double)(2 * this.a);
            this.x2 = ((double)(-this.b) - Math.sqrt((double)(this.b * this.b - 4 * this.a * this.c))) / (double)(2 * this.a);
        }

        return result;
    }

    void print() {
        System.out.println("x1=" + this.x1);
        System.out.println("x2=" + this.x2);
    }
}
